import { Component } from '@angular/core';

import { AlertController, NavController, NavParams } from 'ionic-angular';

import {MarketingDailySavePage} from "../save/save.component";

@Component({
  selector: 'page-marketing-daily-detail',
  templateUrl: './detail.html'
})
export class MarketingDailyDetailPage {
	moa_page_name: any = "page-marketing-daily-detail";
  moa_page_explain: any = "工作日报详情";

  detail: null;
  communicateType = 0;

  constructor(
    public alertCtrl: AlertController,
    public navCtrl: NavController,
    private navParams: NavParams
  ) {
      this.detail = this.navParams.get("detail");
      if (this.detail[0] == "机构客户") {
        this.communicateType = 0;
      } else {
        this.communicateType = 1;
      }
      console.log(this.detail);
  }

  edit() {
    if (this.detail[16] == 0) {
      let alert = this.alertCtrl.create({
        title: "提示",
        message: "内容太长，请去USP平台编辑",
        buttons: [
          {
            text: "确定",
            role: 'cancel',
            handler: () => {

            }
          }
        ]
      });
      alert.present();
      return;
    }
    this.navCtrl.push(MarketingDailySavePage, {
      "isEdit": true,
      "detail": this.detail
    });
  }


}
